import React from 'react'

import store from '../../store/store'

import {movieAction} from '../../store/Action/movieAction'

export default function Movie() {
  // console.log(store.getState());
  const {count}  = store.getState().count
  const {movieList}  = store.getState().movie

  const getMovie = ()=>{
    store.dispatch(movieAction())
  }

  return (
    <div>
      <h1>我是Movie组件</h1>
      <p>我收到的Count组件的值是{count}</p>

      <button onClick={getMovie}>获取电影的数据</button>
      <ul>
        {
          movieList.map(item=>{
            return <li key={item.albumId}>{item.name}</li>
          })
        }
      </ul>
    </div>
  )
}
